<?php
include 'user.php';
include_once('./dao/TeamDao.php');

include_once 'helper.php';
authenticate();

$team_dao = new TeamDao();
$user_dao = new UserDao();

if($_POST['submit']){
	$team_dao->addTeammateByUwId($_POST['teamid'], $_POST['uwid'],0); /* You never add captain */
	$success=1;
}

$team_ids = $team_dao->lookupTeamsByUwId( $_SESSION['user']->getStudentId());

$teams = array();
for( $ix = 0; $ix < count($team_ids); ++$ix ) {
	array_push($teams, $team_dao->lookupTeam( $team_ids[$ix] ));
}
include '../view/team.php';
?>
